package com.itheima.a14waitandnotify;

import java.util.concurrent.ArrayBlockingQueue;

public class ThreadDemo {

    /**
     * 阻塞队列实现生产者和消费者名字  二者必须在同一个阻塞队列中   -- 阻塞队列写在测试类中
     * Cook和Food对象构造方法中传入阻塞队列
     */
    public static void main(String[] args) {
        ArrayBlockingQueue<String> queue = new ArrayBlockingQueue<String>(1) ;  //1标识最多只能放一个


        Foodie foodie = new Foodie(queue) ;
        Cook cook = new Cook(queue) ;

        cook.start();
        foodie.start();
    }
}
